package com.dataeco.api.entity;

import javax.persistence.Embeddable;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import java.io.Serializable;

@Embeddable  // 标识当前类要作为一个可嵌入的联合主键来用
public class UserRoleKey implements Serializable{
    private static final long serialVersionUID=3210400781222992464L;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id")
    private User user;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "role_id")
    private Roles dataecoRole;

    public UserRoleKey(){
    }

    public UserRoleKey(User user, Roles dataecoRole) {
        this.user = user;
        this.dataecoRole = dataecoRole;
    }

    public User getUser() {
        return user;
    }

    public Roles getDataecoRole() {
        return dataecoRole;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public void setDataecoRole(Roles dataecoRole) {
        this.dataecoRole = dataecoRole;
    }
}
